package com.itheima.objstream;

import com.itheima.domain.User;

import java.io.*;

public class Demo05 {


    public static void main(String[] args) throws IOException, ClassNotFoundException {
        //inObject();
        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("day13\\1243.txt"));
        User u = new User("124sdfsd", "adgdfgdf");
        oos.writeObject(u);
        oos.close();


    }
    /*
       读数据
        */
    private static void inObject() throws IOException, ClassNotFoundException {
        //创建输入流
        ObjectInputStream ois = new ObjectInputStream(new FileInputStream("day13\\user.txt"));
        Object o = ois.readObject();
        System.out.println(o);
        ois.close();
    }
}
